import request from '@/utils/request'
import myRequest from '@/utils/myRequest'

// 登录方法
export function login(params) {
  return myRequest({
    url: '/login',
    method: 'post',
    params: params
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/getInfo',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    method: 'get'
  })
}

/**
 * 获取短信验证码
 * url:'/sendValidateCode'
 * method:POST
 * @Header Authorization: 登录接口返回的token
 * @Query params:{
 * }
 * @returns {*}
 */
export const getMessageCodeAPI = (params = {}) => {
  return request.post(`/sendValidateCode?username=${params.username}&password=${params.password}`, params)
}
